<!DOCTYPE HTML>
<html  lang="zh" xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-zhBanner-edit" th:object="${zhBanner}">
            <input id="id" name="id" th:field="*{id}"  type="hidden">
			<div class="form-group">	
				<label class="col-sm-3 control-label">描述文字：</label>
				<div class="col-sm-8">
					<input id="text" name="text" th:field="*{text}" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group" style="display: none">
				<label class="col-sm-3 control-label">地址：</label>
				<div class="col-sm-8">
					<input id="url" name="url" th:field="*{url}" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">站点：</label>
				<div class="col-sm-8">
					<select id="deptId" name="deptId" class="form-control m-b" >
						<option th:each="zhDept:${zhDepts}" th:value="${zhDept.deptId}" th:text="${zhDept.name}" th:field="*{deptId}"></option>
					</select>
				</div>
			</div>

			<div class="form-group">
				<label class="col-sm-3 control-label">备注：</label>
				<div class="col-sm-8">
					<textarea id="remark" name="remark" class="form-control" th:field="*{remark}"></textarea>
				</div>
			</div>

			<div class="form-group">
				<label class="col-sm-3 control-label">图片(建议尺寸680x476)：</label>
				<button type="button" class="layui-btn" id="test1" style="margin-left: 15px;">
					<i class="layui-icon">&#xe67c;</i>上传图片
				</button>
			</div>

			<div class="form-group">
				<label class="col-sm-3 control-label">预览：</label>
				<img id="preview" height="100" width="150" style="cursor: pointer;margin-left: 15px;" th:src="${zhBanner.url}"/>
			</div>

		</form>
    </div>
    <div th:include="include::footer"></div>

    <script type="text/javascript">
		var prefix = ctx + "system/zhBanner";
		$("#form-zhBanner-edit").validate({
			rules:{
				xxxx:{
					required:true,
				},
			}
		});
		
		function submitHandler() {
	        if ($.validate.form()) {
	            $.operate.save(prefix + "/edit", $('#form-zhBanner-edit').serialize());
	        }
	    }
	</script>
	<script type="text/javascript">
		layui.use('upload', function(){
			var preview_img =$('#preview')
			preview_img.on("click",function(e){
				layer.photos({ photos: {"data": [{"src": e.target.src}]} });
			});
			var upload = layui.upload;
			var layer = layui.layer;
			//执行实例
			renderUpload(upload,$('#test1'),$('#preview'),$('#url'))
		});
	</script>

</body>
</html>
